﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Weebing.Web
{
    public partial class Site : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["Weebing"] != null)
            {

                string language = Request.Cookies["Weebing"]["Language"];

                if (!string.IsNullOrEmpty(language))
                {
                    int clid = int.Parse(language);
                    var culture = new System.Globalization.CultureInfo(clid);

                    System.Threading.Thread.CurrentThread.CurrentCulture = culture;
                    System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
                }
            }
        }

        protected void listLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listLanguage.SelectedValue.Length == 4)
            {
                int clid = int.Parse(listLanguage.SelectedValue);

                Response.Cookies["Weebing"]["Language"] = clid.ToString();

                Response.Redirect("Default.aspx");
            }
        }
    }
}
